package cn.kgc.mybatis05.mapper;

import cn.kgc.mybatis05.entity.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @Author: 课工场
 * @Version: v1.0  2023/2/10
 * @Description: mybatis注解开发
 */
public interface UserMapper {

    //@Select("select *  from user")
    List<User> selectList();

    //@Select("select *  from user where id = #{id}")
    User selectById(Integer id);

    @Insert("insert into user(uname,password,state)values(#{uname},#{password},#{state})")
    Integer addUser(User user);

    @Update("update user set uname = #{uname},password = #{password} where id = #{id}")
    Integer updateUser(User user);

    @Delete("delete from user where id =#{id}")
    Integer deleteById(Integer id);

}
